Textboxes next to each other

Hello,

 

I want to create 2 textboxes next to each other. The simple placement "beside" doesn't do anything.

 

The following code doesn't work aswell, because the first textbox will not be shown.

 

DB db = create("heading", styleCentered)
DBE textbox1 = text(db,"Target:","",250,500,true)
DBE textbox2 = text(db,"Source:","",250,500,true)


textbox1 -> "right" -> "unattached"
textbox2 -> "left" -> "unattached"
textbox2 -> "top" -> "aligned" -> textbox1
textbox2 -> "left" -> "spaced" -> textbox1


show db

 

 

What can I do?

 

Best regards

itnoc

 


itnoc - Wed Sep 02 10:41:59 EDT 2015

Re: Textboxes next to each other
pommCannelle - Thu Sep 03 04:12:37 EDT 2015

( You should try to explicitly define the 4 borders behavior ... 

void doclose(DB x){ hide x; destroy x }

DB db = create("heading", styleCentered)
DBE textbox1 = text(db,"Target:","",250,300,true)
DBE textbox2 = text(db,"Source:","",250,300,true)

close(db, false, doclose)

textbox1->"top"->"form" 
textbox1->"left"->"form" 
textbox1->"bottom"->"form" 
textbox1->"right"->"unattached" 

textbox2->"top"->"aligned"->textbox1
textbox2->"left"->"unattached" 
textbox2->"bottom"->"form" 
textbox2->"right"->"form"


show db

Enjoy ! )

Re: Textboxes next to each other
itnoc - Thu Sep 03 11:19:34 EDT 2015

Apart from a small mistake (textbox2 left spaced to textbox1 missing) this works perfectly, thanks a lot.

However if I try it with rich text boxes, it looks odd, because they're not on the same height. Someone knows how to fix this?

 

Edit:

Figured it out now, textbox2 shouldn't be aligned but attached to form on the top. Then it works perfectly:

 

void doclose(DB x){ hide x; destroy x }

DB db = create("heading", styleCentered)
DBE textbox1 = richText(db,"Target:","",250,300,true)
DBE textbox2 = richText(db,"Source:","",250,300,true)

close(db, false, doclose)

textbox1->"top"->"form"
textbox1->"left"->"form"
textbox1->"bottom"->"form"
textbox1->"right"->"unattached"

textbox2->"top"->"form"
textbox2->"left"->"spaced"->textbox1
textbox2->"bottom"->"form"
textbox2->"right"->"form"


show db

Re: Textboxes next to each other
llandale - Tue Sep 08 17:18:20 EDT 2015

I had some trouble in this area aligning "text" boxes but I cannot find my notes.  I suppose attaching the top to the "form" works, but otherwise you need to attach the 2nd one to some other DBE and not to the previous text box.

void doclose(DB x){ hide x; destroy x }

DB db = create("heading", styleCentered)
DBE s = label(db, "")
DBE textbox1 = text(db,"Target:","",250,300,true)
DBE textbox2 = text(db,"Source:","",250,300,true)
DBE r = label(db, "")
close(db, false, doclose)

textbox1->"top"->"spaced" ->s
//textbox1->"left"->"form"
//textbox1->"bottom"->"unattached"
textbox1->"right"->"unattached"

textbox2->"top"->"spaced" ->s
textbox2->"left"->"spaced" ->textbox1
textbox2->"bottom"->"unattached"
//textbox2->"right"->"form"

r ->"top" ->"spaced" ->textbox2

close(db, true, doclose)
show db

Note the 2nd empty label "r" provides a fluent bottom to the two boxes, so you can see the bottom "apply" and "close" buttons.  Additional DBEs can be attached to that.

-Louie